class SceneOver extends Scene {
  constructor(game, score) {
    super(game)
    this.score = score
    this.setup()
  }
  setup() {
    const game = this.game
    window.addEventListener('keydown', (event) => {
      if (event.key == 'r') {
        let sceneMain = new SceneMain(game)
        game.over = false
        game.runWithScene(sceneMain)
      }
    })
  }
  draw() {
    const context = this.game.context
    context.font = '16px Arial'
    context.fillStyle = '#f00'
    context.fillText(`游戏结束，得分：${this.score}， 按 R 重新开始`, 200, 200)
  }
}